<script setup lang="ts">
import { defineProps, ref } from 'vue'
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
const showHomeBtn = ref(0)
onLoad((options: any) => {
  // debugger
  if (options.showHomeBtn == 1) {
    showHomeBtn.value = 1

  }
})
let props = defineProps({
  autoBack: {
    type: Boolean,
    default: false
  },
  enableBack: {
    type: Boolean,
    default: true
  },
  from_url: {
    type: Boolean,
    default: false
  },
  placeholder: {
    type: Boolean,
    default: true
  },
  showLeft: {
    type: Boolean,
    default: true
  },
  is_show: {
    type: Boolean,
    default: true
  }

})

const backToHome = () => {
  uni.switchTab({
    url: `/pages/index/index`
  })
}

const naviBack = () => {
  // debugger
  if (showHomeBtn.value == 1) {
    uni.reLaunch({
      url: `/pages/index/index`
    })
  } else {
    uni.navigateBack()
  }

}


</script>

<template>

    <u-navbar title="" height="90rpx" :placeholder="placeholder" :border="true" v-if="is_show">
      <template #center>
        <view class="center">
          <view>FORONE 会一</view>
          <view class="r">R</view>
        </view>
      </template>
      <template #left>
        <view class="u-nav-slot casu" v-if="showHomeBtn == 1 || showLeft" @click="naviBack">
          <view style="width: 10rpx;"></view>
          <view style="background-color: #f3f3f3;padding: 10rpx;border-radius: 50%;">


            <u-icon :name="showHomeBtn == 1 ? 'home' : 'arrow-left'" size="20"></u-icon>

          </view>
          <!-- <u-line direction="column" :hairline="false" length="40" margin="0 8px" @click="naviBack" ></u-line> -->
          <!-- <u-icon name="home" size="20" @click="backToHome" ></u-icon> -->
        </view>
        <!-- <view class="u-nav-slot casu" v-if="showHomeBtn == 1 && showLeft">
        <u-icon name="home" size="20" @click="backToHome" ></u-icon>
      </view> -->
      </template>

    </u-navbar>

</template>

<style scoped lang="scss">
$size: 22rpx;
$font-size: 22rpx;

.center {
  position: relative;
  color: #ed680e;
  font-weight: bold;
  font-size: 36rpx;

  .r {
    position: absolute;
    font-size: $font-size;
    //font-weight: normal;
    //font-family: "Apple Color Emoji";
    right: -28rpx;
    top: -4rpx;
    display: inline-block;
    width: $size;
    height: $size;
    border: 2rpx solid #ed680e;
    border-radius: 50%;
    text-align: center;
    line-height: $size;
  }
}

.casu {
  display: flex;
  width: 40vw;
}
</style>
